<template v-slot="t">
  用户联系方式列表
  <div style="float: right">
    <el-button type="success" round @click="toexcel">导出excel</el-button>
  </div>
  <el-table :data="tableData" style="width: 100%">
    <el-table-column prop="username" label="姓名" width="auto"></el-table-column>
    <el-table-column prop="phone" label="联系电话" width="auto">
    </el-table-column>
    <el-table-column prop="email" label="邮箱"></el-table-column>
    <el-table-column prop="city" label="城市"></el-table-column>
    <el-table-column v-slot="scope1">
      <el-collapse v-model="activeNames" @change="xianshi(scope1.row.address)">
        <el-collapse-item title="用户详情" name="1">
          <div>
            姓名:{{ scope1.row.username }}<br/>
            联系电话:{{ scope1.row.phone }}<br/>
            邮箱:{{ scope1.row.email }}<br/>
            城市:{{ scope1.row.city }}<br/>
            医院或公司:{{ scope1.row.hospital }}<br/>
            科室或部门:{{ scope1.row.department }}<br/>
            备注:{{ scope1.row.remarks }}
          </div>
        </el-collapse-item>
      </el-collapse>
    </el-table-column>
  </el-table>
  <div class="block">
    <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        v-model:currentPage="currentPage3"
        :page-size="10"
        layout="prev, pager, next, jumper"
        :total="total"
    >
    </el-pagination>
  </div>
</template>
<script>
export default {
  props: ['jwttoken'],
  name: "UserLianXiList",
  data() {
    return {
      flag: false,
      user: "",
      loading: false,
      total: 0,
      page: 1,
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎1",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-04",
          name: "王小虎2",
          address: "上海市普陀区金沙江路 1517 弄",
        },
        {
          date: "2016-05-01",
          name: "王小虎3",
          address: "上海市普陀区金沙江路 1519 弄",
        },
        {
          date: "2016-05-03",
          name: "王小虎4",
          address: "上海市普陀区金沙江路 1516 弄",
        },
        {
          date: "2016-05-02",
          name: "王小虎5",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-04",
          name: "王小虎6",
          address: "上海市普陀区金沙江路 1517 弄",
        },
        {
          date: "2016-05-01",
          name: "王小虎7",
          address: "上海市普陀区金沙江路 1519 弄",
        },
        {
          date: "2016-05-03",
          name: "王小虎8",
          address: "上海市普陀区金沙江路 1516 弄",
        },
        {
          date: "2016-05-02",
          name: "王小虎9",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-04",
          name: "王小虎10",
          address: "上海市普陀区金沙江路 1517 弄",
        },
      ],
    };
  },
  methods: {
    toexcel: function () {
      window.location.href = "http://api.mevionchina.com/toexcel";
    },
    xianshi(date) {
      //   this.user = date.name;
      //   this.flag = true;
      console.log(date);
    },
    edit: function () {
      this.$router.push("/EditZhaopin");
    },
    getlianxiuserlist: function (page) {
      this.loading = true;
      let that = this;
      this.$jquery.ajax({
        async: false,
        type: "GET",
        dataType: "json",
        url: this.$baseurl + "getLianXiUserList/10/" + page,
        beforeSend: function (request) {
          request.setRequestHeader("Authorization", that.jwttoken);
        },
        success: function (rtn) {
          if (rtn.code == -5) {
            that.$emit("loginstate1", -1);
          }
          if (rtn.code == 1) {
            that.tableData = rtn.data.data;
            that.total = rtn.data.count;
            that.loading = false;
          }
        },
      });
    },
    handleCurrentChange: function (page) {
      this.getlianxiuserlist(page);
    },
  },
  created: function () {
    this.getlianxiuserlist(1)
  },
};
</script>
